<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>

<?php
if( (int)$params->get('mod_layout', 0) == 0 ){
	$stat['display'] = 'none';
	$stat['innerHTML'] = 'Use Extended Query';
}else{
	$stat['display'] = 'block';
	$stat['innerHTML'] = 'Use Simple Query';
}
?>


<script>
	function toggle_ext(){
		var $ext_form = document.getElementById('ext_mod_bookstore');
		var $simple_form_anchor = document.getElementById('a_simple_mod_bookstore');
		if(	$ext_form.style.display == 'none'){
			$ext_form.style.display = 'block';
			$simple_form_anchor.innerHTML = 'Use Simple Query';
		}else{
			$ext_form.style.display = 'none';
			$simple_form_anchor.innerHTML = 'Use Extended Query';
		}//end if that toggles
	}
</script>
<div id='simple_mod_bookstore' style="width:220px; margin-left: 7px; margin-top: 67px">
	<form action="<?php echo $component_url; ?>" method="post" name="queryForm" target="_top" id="bookstore_queryForm" class="form-bookstore_query">
		<div class="query">			
			<div><input type="text" name="terms" id="query_box" size="33" class="inputbox" value="<?php
			 $term->keyword = JRequest::getVar('terms','');
			 JFilterOutput::objectHTMLSafe($term);
			 echo $term->keyword;
			 ?>" /></div>
			<div style="width:90px; float:left; margin: 2px 0px 0px 0px;"><button class="button validate" type="submit"><?php echo JText::_('Submit'); ?></button></div>
            <div id='select_ext' style="float:left; font-size: 9px; width: 90px; height:40px; text-align: left; margin-top: 8px"><a id="a_simple_mod_bookstore"href="#" onclick="toggle_ext()"><?php echo $stat['innerHTML']; ?></a></div>
            
			 <div style="width:20px; float:left; margin: 2px 0px 0px 0px;">
			<?php
			//<div style="float:left; width:100px"><input type="checkbox" name="instock_only" id="instock_only" class="inputbox" value="checked" 
			$url	= 'components'.DS.'com_bookstore'.DS.'helpers'.DS.'instructions.php';
				$status = "{handler: 'iframe', size: {x: 650, y: 650}}";
				$link_attribs['class']	= JText::_( 'modal' );
				$link_attribs['rel'] = "".$status."";
				$text = '<img src="/stable/images/iicon.png" alt="Getting Started with BookPeople Book Search" style="border: medium none ; text-decoration: none; width: 20px; height: 20px;" />';
				$link = JHTML::_('link',$url, $text, $link_attribs);
				//$html .= $link;
				echo $link;
			 ///>In stock only</div>
			  ?></div>
        </div>
	<input type="hidden" name="instock_only" value="checked" />
	<input type="hidden" name="option" value="com_bookstore" />
    <input type="hidden" name="view" value="bookstore" />
    <input type="hidden" name="query_type" value="0" />
	</form>
   
</div>
